﻿@using System.Data
@model BarPlugin.Models.VM_PItem
@{
    Layout = "_PostBar.cshtml";
}
@section head{
<link href="/Plugins/Ueditor/third-party/video-js/video-js.min.css" rel="stylesheet" />
<link type="text/css" rel="stylesheet" href="/Plugins/FancyBox/jquery.fancybox.css" />
<link type="text/css" rel="stylesheet" href="/Plugins/FancyBox/jquery.fancybox-thumbs.css" />
<script src="/Plugins/Ueditor/bar.config.js"></script>
<script src="/Plugins/Ueditor/ueditor.all.js"></script>
<script type="text/javascript" src="/JS/jquery-ui.min.js"></script>
<script type="text/javascript" src="/Plugins/FancyBox/jquery.fancybox.js"></script>
<script type="text/javascript" src="/Plugins/FancyBox/jquery.fancybox-thumbs.js"></script>
<script type="text/javascript" src="/JS/ICMS/MainBlog.js"></script>
<script src="/Plugins/Ueditor/third-party/zeroclipboard/ZeroClipboard.min.js"></script>
<script src="/JS/ICMS/ZL_Common.js"></script>
<title>@Model.barMod.Title</title>
}
@section content{
<div class="container">
    <div class="post_div">
        <div id="contentDiv">
            <div class="post_div_num">
                <div class="title"><span id="PostName_L">@Model.barMod.Title</span></div>
                <a href="javascript:;" id="copyhref" class="opition hidden-xs" title="复制链接">[复制链接]</a>
                <div class="pull-right">
                    <a href="/PClass?id=@Model.barMod.CateID"><i class='fa fa-arrow-circle-left'></i>返回@(Model.cateMod.CateName)</a>
                    <div class="share_box">
                        <a href="javascript:;" id="bar_share"><i class="fa fa-share-alt"></i>分享</a>
                        <div class="bdsharebuttonbox pull-right"><a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"></a><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_more" data-cmd="more"></a></div>
                        <script>window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": $('#PostName_L').text() + document.URL, "bdUrl": document.URL, "bdMini": "2", "bdMiniList": false, "bdPic": "", "bdStyle": "2", "bdSize": "32" }, "share": {} }; with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];</script>
                    </div>
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="post_div_title">
                <div class="pull-left reply_title"><span class="card_menNum" id="replynum_span1">@(Model.setting.itemCount - 1)</span>回复贴，共<span class="card_menNum" id="pagenum_span1">@Model.setting.pageCount</span>页，点击数:<span class="card_menNum" id="hitcount_span">@Model.barMod.HitCount</span></div>
                <div class="pull-right">
                    @if (Model.auth_edit)
                    {
                        <div class="dropdown" id="EditBtn_DIV" style="display:inline-block;">
                            <button class="btn btn-xs btn-primary dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">编辑<span class="caret"></span></button>
                            <ul class="dropdown-menu editdrop" aria-labelledby="dropdownMenu1">
                                <li><a href="/EditContent?ID=@Model.barMod.ID"><span class="fa fa-pencil"></span> 编辑</a></li>
                                <li><a href="javascript:;" onclick="PostDelMsg('@Model.barMod.ID',1)"><span class="fa fa-trash"></span> 删除</a></li>
                            </ul>
                        </div>
                    }
                    <a href="/PItem?id=@Model.barMod.ID&Filter=OnlyLayer" class="btn btn-xs btn-primary">只看楼主</a>
                    @if (Model.auth_like)
                    {<input type='button' value='收藏' id='liketie' onclick='ColledBtn(this,@Model.barMod.ID)' class='btn btn-xs btn-primary' />}
                    else
                    {<input type='button' value='取消收藏' id='liketie' onclick='ColledBtn(this,@Model.barMod.ID)' class='btn btn-xs btn-primary collbtn' />}
                    <input type="button" value="回复" class="btn btn-xs btn-primary" onclick="FocusMsg();" />
                </div>
                <div class="clearfix"></div>
            </div>
            @Html.Partial("PItem_List", Model)
        </div>
        <div class="post_foot_num">
            <span class="card_menNum">@(Model.setting.itemCount - 1)</span>回复贴，共<span class="card_menNum">@Model.setting.pageCount</span>页
        </div>
        @if (Model.auth_send)
        {
            <form method="post" action="/Bar/Post_Add?pid=@(Model.barMod.ID)&rurl=/pitem?id=@Model.barMod.ID">
                <div class="send_div" id="send_div">
                    <!--回复主贴-->
                    <div>
                        <div class="text-left"><span class="fa fa-comment padding_l_5"></span><strong>发表回复</strong></div>
                    </div>
                    <div class="clearfix"></div>
                    <div class="padding_b_5"><textarea id="MsgContent_T" name="MsgContent_T" style="height:200px;"></textarea></div>
                    <input type="text" id="VCode" name="VCode" placeholder="验证码" maxlength="6" class="form-control text_x" autocomplete="off" />
                    <img id="VCode_img" class="codeimg" title="点击刷新验证码" />
                    <input type="hidden" id="VCode_hid" name="VCode_hid" />
                    <input type="submit" value="发表主题" onclick="return CheckData();" class="btn btn-primary"/>
                </div>
            </form>
        }
        else
        {
            <div id="noauth_div">您未登录,没有发贴权限<span><a href="/User/Login?returnUrl=@Request.RawUrl">[点此登录]</a></span></div>
        }
        @MvcHtmlString.Create(Call.GetUEditor("MsgContent_T", 4))
    </div>
</div>
<div class="floattool">
    <ul>
        <!--<a href="javascript:;"><span class="txtSpan">回 到 顶 部</span></a>-->
        <li title="回到顶部" onclick="returnTop()" onmouseout="hideTxt(this)" onmouseover="showTxt(this)"><a href="javascript:;"><span class="fa fa-arrow-up"></span></a><span class="txtSpan">回 到 顶 部</span></li>
        <li title="发表帖子" style="position: relative;" onclick="returnDown()" onmouseout="hideTxt(this)" onmouseover="showTxt(this)"><a href="@Request.RawUrl"><span class="fa fa-edit"></span></a><span class="txtSpan">发 表 帖 子</span></li>
        <li title="贴吧列表" onclick="returnPost()" onmouseout="hideTxt(this)" onmouseover="showTxt(this)"><a href="/Index" class="last"><span class="fa fa-th"></span></a><span class="txtSpan">回 到 社 区</span></li>
    </ul>
</div>
@if(Model.auth_barowner)
{
    <form method="post" id="op_form">
         <div id="barowner_div"  class="zIndex9">
    <div id="funcdiv" class="panel panel-primary candrag">         
        <div class="panel-body">
                 <div style="padding: 5px;">
                    <div class="func_item"><button type="button" onclick="submitop('Del');"><i class="fa fa-close"><span> 删除</span></i>真的不要了吗</button></div>
                    <div class="func_item"><button type="button" onclick="submitop('Hidden');"><i class="fa fa-eye-slash"><span> 屏蔽</span></i> 折戟沉沙</button></div>
                    <div class="func_item"><button type="button" onclick="submitop('CancelHidden');"><i class="fa fa-eye"><span> 取消屏蔽</span></i>重见天日</button></div>
                    <div class="func_item"><button type="button" onclick="submitop('AddRecom');"><i class="fa fa-eye"><span> 精华</span></i>很好的帖子</button></div>
                    <div class="func_item"><button type="button" onclick="submitop('RemoveRecom');"><i class="fa fa-close"><span> 取消精华</span></i>换其他的看看</button></div>
                </div>
                <div style="padding: 5px;">
                    <div class="func_item"><button type="button" onclick="submitop('AddAllTop');"><i class="fa fa-arrow-circle-up"><span> 全局置顶</span></i>置为全局帖子</button></div>
                    <div class="func_item"><button type="button" onclick="submitop('AddTop');"><i class="fa fa-level-up"><span> 版块置顶</span></i>置为头条帖子</button></div>
                    <div class="func_item"><button type="button" onclick="submitop('RemoveTop');"><i class="fa fa-backward"><span> 取消置顶</span></i>有更好的啦</button></div>
                    <div class="func_item"><button type="button" onclick="submitop('AddBottom');"><i class="fa  fa-level-down"><span> 沉底</span></i>放在最底下</button></div>
                    <div class="func_item"><button type="button" onclick="submitop('RemoveBottom');"><i class="fa fa-forward"><span> 取消沉底</span></i>放上来再晒晒</button></div>
                </div>
        </div>
    </div>
</div>
        <input type="hidden" name="ids" id="ids" />
    </form>
    <script>
        function submitop(action) {
            $.post("/Bar/Post_OP?action=" + action, { cateid: "@Model.barMod.CateID", ids: mvcpage.help.getchk("idchk") }, function (data) {
                if (data == M_APIResult.Success) { location = location; }
                else { alert("操作失败"); }
            });
        }
    </script>
}
<div id="privatediv" class="modal site_mail_div">
  <div class="modal-dialog">
	<div class="modal-content">
	  <div class="modal-body padding0">
		<div class="site_mail_title"><span class="pull-left"><i class="fa fa-edit"></i>发送站内信</span><span class="pull-right fa fa-remove grayremind" title="关闭" onclick="PrivateClose();"></span> </div>
		<table id="privatetable">		  
		  <tr>
			<td class="centertd"><span class="grayremind">收信人：  </span></td>
			<td><div class="text_s">
				<input type="text" id="ReceUser" class="form-control text_s"/>
				<input type="hidden" id="ReceUser_Hid"/></div></td>
		  </tr>
		  <tr>
			<td class="centertd"><span class="grayremind">内容：  </span></td>
			<td><asp:TextBox CssClass="site_mail_content" runat="server" ID="MailContent" TextMode="MultiLine"/></td>
		  </tr>
		  <tr class="text-center"> 
			<td  colspan="2"><input type="button" id="prvatesend_btn" value="发送" onclick="PrivateSend();" class="btn btn-primary" /></td>
		  </tr>
		</table>
	  </div>
	</div> 
  </div>
</div>
@MvcHtmlString.Create(Call.GetUEditor("MailContent", 1))
<div id="metals_div">
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title"><span id="metals_title"></span> <span class="pull-right" style="cursor:pointer;" onclick="$('#metals_div').hide();"><i class="fa fa-remove"></i></span></h3>
      </div>
      <div class="panel-body" id="metals_body">
      </div>
    </div>
</div>
}
@section script{
<style>
    .padding0{ padding-left:0; padding-right:0;} 
    #privatetable{ padding:20px; width:90%;} 
    #privatetable td{ margin-bottom:5px; min-width:80px;}
    #metals_div{position:fixed;top:30%;left:40%; width:500px;display:none;z-index:999;}
    .site_mail_title{ padding-left:15px; padding-right:15px; margin-bottom:20px; width:100%; height:50px; line-height:50px; border-bottom:1px solid #eee; box-shadow:0 2px 5px #eee;}
    .site_mail_title .pull-left{ font-size:18px;}
    .site_mail_title .pull-left i{ margin-right:10px; font-size:24px; color:#ff00dc;}
    .centertd{ text-align:right;}
    .editdrop{min-width:100px;} 
    .stickit{position:fixed;top:50px; z-index:1000;}
    /*点赞*/
    .likeids_div_ul {text-align:left;padding-left:2px;}
    .likeids_div_ul .likeids_div_a {color:#fff;}
    .likeids_div_ul li img{width:25px;height:25px;}
    /*勋章*/

</style>
<script src="/JS/ZL_ValidateCode.js"></script>
<script src="/JS/Controls/B_User.js"></script>
<script type="text/javascript">
    var buser = new B_User();
    $().ready(function () {
        SetImg('@Model.cateMod.BarImage');
        $("input[name=sayword_btn]").each(function () {
            var id = $(this).attr("data-id");
            var len = $("#reply_content_div_" + id).find("div").length;
            if (len == 0)//回复区下有内容
            {
                $(this).hide();
                $("#msg_toggle_a_" + id).text("回复");
            }
        });
        $(".header_index_login_run").attr("href", '/User/Login?returnUrl=@Request.RawUrl');
        $("#VCode").ValidateCode();
        $.post("/API/UserSinIn.ashx", { action: "sinstatu", localtion: "1" }, function (data) {
            if (data != "none") {
                $("#sinin_bu").val("已签到").attr("disabled", "disabled");
                $(".sinDays").text("连续" + data + "天");
            }
        }, "json");
        var client = new ZeroClipboard(document.getElementById("copyhref"));
        client.on("ready", function (readyEvent) {
            client.on('copy', function (e) { client.setText($("#PostName_L").text() + "\n" + location.href); });
            client.on("aftercopy", function (event) { alert("复制完成"); });
        });
        $(":checkbox[name=idchk]").click(function () {
            if ($(":checkbox[name=idchk]:checked").length > 0) {
                var e = event || window.event;
                $("#barowner_div").css({
                    top: e.clientY - 150,
                    left: e.clientX - 300,
                })
                $("#barowner_div").show();
            }
            else $("#barowner_div").hide();
        });
        $(".candrag").draggable
           ({
               addClasses: false,
               axis: false,
               cursor: 'crosshair',
               containment: 'document'
           });
        $(".msg_content_div img").each(function () {
            var src = $(this).attr("src").toLowerCase();
            if (src.indexOf("/attachment/") > 0 || src.indexOf("/emotion/") > 0 || src == "") return;
            $(this).wrap($("<a class='athumbnail_img' rel='group' href='" + $(this).attr("src") + "'></a>"));
            $(this).addClass($("thumbnail_img"));
        })
        $(".athumbnail_img").fancybox({
            'titlePosition': 'over',
            helpers: {
                thumbs: {
                    width: 50,
                    height: 50
                }
            }
        });//end;

    });

    function showTxt(data) {
        $(data).children().first().hide();
    }
    function hideTxt(data) {
        $(data).children().first().show();
    }
    function returnPost() {
        window.location = "/Index";
    }
    function returnTop() {
        setTimeout(setScollTop, 1);
    }
    function setScollTop() {
        if ($(window).scrollTop() > 1) {
            $(window).scrollTop($(window).scrollTop() - 30);
            setTimeout(setScollTop, 1);
        }
    }
    function returnDown() {
        window.location = "/EditContent?ID=-1&CateID=@Model.barMod.CateID";
    }
    function DisReply(id) {
        var t = $(event.srcElement);
        if (t.text() == "回复") { t.text("↓收起回复"); $("#reply_" + id).show("middle"); $("#reply_bottom_ul_" + id).show(); }
        else { t.text("回复"); $("#reply_" + id).hide("middle"); }
    }
    function DisReplyul(id) {
        $("#reply_bottom_ul_" + id).toggle("middle");
    }
    function CheckData() {
        var msg = UE.getEditor("MsgContent_T").getContent();
        if (msg.replace(" ", "") == "") { alert("内容不能为空"); return false; }
        if ($("#TxtValidateCode").val() == "") { alert("验证码不能为空"); return false; }
        return true;
    }
    function FocusMsg() {
        $(window).scrollTop($(document).height());
        $("MsgContent_T").focus();
    }
    function SinIn(e) {
        $.post("/API/UserSinIn.ashx?action=sinin", { localtion: "1" }, function (data) {
            if (data != "" && d != "-1") {
                $(e).val("已签到");
                $(e).attr("disabled", "disabled");
                $("#sinDays").text("连续" + data + "天");
            } else { alert("您尚未登录！！"); }
        });
    }
    function GetMsgMainID(id) {
        return "msgmain_div_" + id;
    }
    function ShowDiv(id) {
        if ($("#" + id).is(":visible"))
            $("#" + id).hide();
        else {
            switch (id) {
                case "ImgFace_Div":
                    if ($("#ImgFace_if").attr("src") == "") {
                        $("#ImgFace_if").attr("src", "/Plugins/Ueditor/dialogs/emotion/ImgFace.html");
                    }
                    break;
            }
            $("#" + id).show();
        }
    }
    function ReplyHer(mid, uname) {
        $("#reply_bottom_ul_" + mid).show();
        $("#reply_ul_txt_" + mid).val("回复 " + uname + " :").focus();
    }
    //-------
    function GetSource() { return "bar"; }
    //----------------AJAX区
    var pageSize = 5;
    function PostDelMsg(msgid, reload) {
        if (confirm("确定要删除该条信息吗!!")) {
            $("#reply_div_" + msgid).remove();
            $.post("/Bar/Post_Del", { cateid: "@Model.barMod.CateID", ids: msgid }, function (data) {
                if (data == "-1") alert("删除失败");
                else
                {
                    if (reload == 1) location = "/PClass?id=@Model.barMod.CateID";
                    else if (reload == 2) {
                        location = location;
                    }
                }
            });
            
        }
    }
    function ColledBtn(obj, id) {
        var action = "AddColl";
        if ($(obj).hasClass("collbtn")) {
            action = "ReColl";
        }
        PostToCS(action, id, function () {
            switch (action) {
                case "AddColl":
                    $(obj).addClass("collbtn");
                    $(obj).val("取消收藏");
                    break;
                case "ReColl":
                    $(obj).removeClass("collbtn");
                    $(obj).val("收藏");
                    break;
            }
        });
    }
    function AddReply(id) {//回复主信息
        var msg = $("#MsgContent_" + id).val();
        if (msg == "") { alert('信息不能为空!!'); return; }
        var value = id + ":::" + msg;
        PostToCS("AddReply", value, function () { LoadReply(id, pageSize, 1); });
    }
    function AddMessage(pid) {//对回复者回复
        var msg = $("#reply_ul_txt_" + pid).val();
        if (msg == "") { alert('信息不能为空!!'); return; }
        if (pid == "") { alert('未指定回复对象!!'); return; }
        var value = pid + ":::" + msg;
        PostToCS("AddReply2", value, function () { LoadReply(pid, pageSize, 1); });
        $("#reply_bottom_ul_" + pid).hide();
        $("#reply_ul_txt_" + pid).val("");

    }
    //添加勋章
    function AddMedal(obj, id) {
        if ($(obj).hasClass("medal_btn_dis")) { return; }
        if (!confirm("是否确定颁发勋章" + ("@Model.auth_barowner" == 'True' ? "" : "(将扣除积分1点)") + "?")) { return; }
        PostToCS("AddMedal", id, function (data) {
            if (data == -2) { alert("您已经颁发过此贴了!"); return; }
            else if (data == -3) { alert("不能给自己颁发勋章!"); return; }
            else if (data == -1) { alert("用户积分不足!"); return; }
            $(obj).addClass("medal_btn_dis");
            $("#medals_div_" + id).append(GetMedalIcon(data));
            $("#like_div_" + id).find('.medalnum_btn').text("(" + $("#medals_div_" + id).children().length + ")");
        });
    }
    //获得勋章图标
    function GetMedalIcon(type) {
        var htmltlp = "<span class='fa-stack fa-lg'><i class='fa fa-sun-o fa-stack-2x'></i><i class='fa fa-stack-1x '>@@type</i></span>";
        var iconstr = "";
        switch (type + "") {
            case "1":
                iconstr = "网";
                break;
            case "2":
                iconstr = "版";
                break;
            case "3":
                iconstr = "系";
                break;
        }
        return htmltlp.replace(/@@type/g, iconstr);
    }
    function PostToCS(a, v, CallBack) {
        PostToCS2("/Bar/Post_API?Pid=@Model.barMod.ID", a, v, CallBack);
    }//Post To CS end;
    function PostToCS2(u, a, v, CallBack) {
        $.ajax({
            type: "Post",
            url: u,
            data: { action: a, value: v },
            success: function (data) {
                CallBack(data);
            },
            error: function (data) {
            }
        });
    }
    function AddFriend(fid) {
        $(".msg_rel_div").hide();
        buser.AddFriend(fid, function (data) { AddFriendCall(data); });
    }
    function CloseUserInfo() {
        $(".msg_rel_div").hide();
    }
    //添加好友成功UI
    function AddFriendCall(data) {
        var mesg = "<div class=\'addinfo\'></div>"
        $("body").append(mesg);
        $(".addinfo").css({
            display: 'none',
            position: 'fixed',
            top: '50%',
            left: '50%',
            marginLeft: '-75px',
            marginTop: '-20px',
            width: '150px',
            height: '40px',
            lineHeight: '40px',
            background: 'rgba(0,0,0,0.6)',
            boxShadow: '0 0 10px 1px rgba(0,0,0,0.3)',
            color: '#fff',
            borderRadius: '20px',
            textAlign: 'center',
        })
        if (data == "-1") {
            $(".addinfo").html("添加好友成功");
        }
        else {
            $(".addinfo").html("你们已经是好友啦");
        }
        $(".addinfo").fadeIn(1000);
        setTimeout(function () { $('.addinfo').fadeOut(1000); }, 2000);
    }

    var uinfointer;
    $(".imgface_mid").hover(function () {
        obj = this;
        uinfointer = setTimeout(function () { UInfoShow(obj) }, 300);
    }, function () {
        clearTimeout(uinfointer);
    });
    var uinfoArr = [];
    function UInfoShow(obj) {
        var uid = $(obj).data("uid");
        $uinfodiv = $(obj).parent().parent().find(".msg_rel_div");
        $(".msg_rel_div").hide();
        $uinfodiv.show();
        buser.GetBarUInfo(uid, function (data) {
            UInfoCallBack(data, $uinfodiv);
        });
    }
    function UInfoCallBack(data, $uinfodiv) {
        UInfoTlpDeal($uinfodiv, data);
        uinfoArr.push(data);
    }
    function UInfoTlpDeal($uinfodiv, data) {
        var tlp = $uinfodiv.html().replace("/Images/ajax-loader.gif", data.UserFace).replace(/@@UserExp/g, data.UserExp).replace("@@Count", data.Count).replace(/@@UserSex/g, data.UserSex).replace("@@GroupName", data.GroupName).replace("@@UserBirth", data.UserBirth).replace("@@RegTime", data.RegTime).replace("@@UserID", data.UserID).replace("@@UserName", data.UserName);
        $uinfodiv.html(tlp);
        $uinfodiv.find(".loading").hide();
        $uinfodiv.find(".loadok").show();
        if (data.UserID <= 0) { $uinfodiv.find(".medalnum_span").html("<span style='color:gray'>匿名用户</span>"); return; }
        //加载勋章
        PostToCS("GetMedalNum", data.UserID, function (result) {
            if (data != "-1") {
                $uinfodiv.find(".medalnum_span").html("<a href='javascript:;' onclick=\"ShowUserMetals(" + data.UserID + ",'" + data.UserName + "')\"><span class='fa fa-sun-o'></span>勋章总数:[" + result + "]</a>");
            }
        })
    }
    //显示用户勋章
    function ShowUserMetals(uid, uname) {
        PostToCS("GetUserMedal", uid, function (data) {
            var medalarr = JSON.parse(data);
            $("#metals_title").html(uname + "的勋章");
            $("#metals_body").html('');
            for (var i = 0; i < medalarr.length; i++) {
                $("#metals_body").append(GetMedalIcon(medalarr[i].medalid));
            }
            $("#metals_div").show();
        });
    }
    function GetSource() { return "@Request.RawUrl"; }
    function LoadReply(pid, psize, cpage) {
        $("#reply_content_div_" + pid).load("/Bar/PostReply?code=" + Math.random() + "&pid=" + pid + "&psize=" + psize + "&cpage=" + cpage);
    }
    //分享设置
    $().ready(function () {
        $(".share_box").mouseover(function (e) {
            $(this).find(".bdsharebuttonbox").show();
        }).mouseout(function (e) {
            $(this).find(".bdsharebuttonbox").hide();
        });;
    })
    var timer;
    $(".msg_left_div ").mouseenter(function () {
        clearTimeout(timer);
    }).mouseleave(function () {
        timer = setTimeout(function () {
            CloseUserInfo();
        }, 1000);
    });
    //用于收藏或点赞,用户头像等信息后台获取并输出
    var LikeComp = {};
    LikeComp.config = { UserID: "@Model.mu.UserID", UserName: "@Model.mu.HoneyName", UserFace: "@Model.mu.UserFace" };
    LikeComp.liTlp = '<li title="@@UserName" class="likeids_li" data-uid="@@UserID"><a href="javascript:;"><img src="@@UserFace" onerror=\"this.src=\'/Images/UserFace/noface.png\'"></a></li>';
    //贴子ID
    LikeComp.AddLike = function (id) {
        var action = "AddLike";
        LikeComp.UpdateUI(action, id);
        $.post("/Bar/Post_API", { "action": action, "value": id }, function (data) { });
    }
    LikeComp.ReLike = function (id) {
        var action = "ReLike";
        LikeComp.UpdateUI(action, id);
        $.post("/Bar/Post_API", { "action": action, "value": id }, function (data) { });
    }
    //更新UI与数量
    LikeComp.UpdateUI = function (action, id) {
        var config = LikeComp.config;
        var $main = $("#like_div_" + id);
        switch (action) {
            case "AddLike":
                var html = LikeComp.liTlp.replace("@@UserName", config.UserName).replace("@@UserFace", config.UserFace).replace("@@UserID", config.UserID);
                $main.find(".likeids_div_ul").append(html);
                break;
            case "ReLike":
                $main.find(".likeids_div_ul li[data-uid=" + LikeComp.config.UserID + "]").remove();
                break;
        }
        $main.find(".likenum_text").text($main.find(".likeids_div_ul li[data-uid]").length);
    }
    function OPLike(id) {
        var filter = "#like_div_" + id + " .likeids_div_ul li[data-uid=" + LikeComp.config.UserID + "]";
        var config = LikeComp.config;
        if ($(filter).length > 0) {
            LikeComp.ReLike(id);
        }
        else {
            LikeComp.AddLike(id);
        }
    }
</script> 

}